package org.marketlive.entity.account;

import org.marketlive.entity.IEntityHome;
import org.marketlive.entity.IPrimaryKey;

/*
(C) Copyright MarketLive. 2006. All rights reserved.
MarketLive is a trademark of MarketLive, Inc.
Warning: This computer program is protected by copyright law and international treaties.
Unauthorized reproduction or distribution of this program, or any portion of it, may result
in severe civil and criminal penalties, and will be prosecuted to the maximum extent
possible under the law.
*/


import java.util.Collection;
import java.util.List;

/**
 * Interface to the <code>Contact</code> entity Home object.
 */
public interface IContactHome extends IEntityHome {

    /**
     * Creates a <code>Contact</code> entity with the given alias.
     * 
     * @param alias String value
     * @return IContact the contact created
     */
    IContact create(final String alias);

    /**
     * Finds an account <code>Contact</code> by alias.
     * 
     * @param alias String value to use in finding the contacts
     * @return Collection of account contact entities matching the supplied alias
     */
    Collection findByAlias(final String alias);

    /**
     * Returns the {@link IContact} with the given code. Code must be unique across all contacts in the instance.
     * An <code>IllegalArgumentException</code> will be thrown if more than one contacts with the given code
     * have been found.   
     *
     * @param code the contact code to search on.
     * @return an instance of <code>IContact</code> if one is found for the given code, null otherwise.
     */
    IContact findByCode(final String code);

    /**
     * Mark an account contact as deleted (delete_flag = true).
     * 
     * @param accountContact entity to mark as deleted
     * @deprecated as of MarketLive 5.5 without replacement. Will be removed in the next major release since 
     * soft delete will not be supported. 
     */
    void markDeleted(final IContact accountContact);

    /**
     * Return all <code>Contact</code> entities belonging to the input Customer key.
     * 
     * @return List of matching cusomters
     */
    List findByCustomerPk(IPrimaryKey pk);

    /**
     * The <code>Contact</code> is a special contact that is shared by all customers.  It is
     * for shipments for which the shipToContact has not been assigned.
     */
    IContact getDefaultShipToContact();    

}
